package com.czkt.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.czkt.entity.vo.StorageProduct;
import com.czkt.service.IStorageService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author jobob
 * @since 2024-06-18
 */
@Controller
public class StorageController {
    @Resource
    IStorageService storageService;

    @RequestMapping("/storage/list")
    public String storageShow(@RequestParam(value = "prodName",defaultValue = "") String prodName,
                              @RequestParam(value = "stkWarehouse",defaultValue = "") String stkWarehouse,
                              @RequestParam(value = "pageIndex",defaultValue = "1") Integer pageIndex,
                              @RequestParam(defaultValue = "3") Integer pageSize, Model model){
        IPage<StorageProduct> storageProductIPage = storageService.selectStorageAndProduct(stkWarehouse,prodName,pageIndex,pageSize);
        model.addAttribute("storagePage",storageProductIPage);
        model.addAttribute("prodName",prodName);
        model.addAttribute("stkWarehouse",stkWarehouse);
        return "/storage/list";
    }
}
